package com.sikaryofficial.workbench.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author : wuweihong
 * @desc : 子订单状态枚举
 * @date : 2024-09-24
 */
@Getter
@AllArgsConstructor
public enum OrderItemStatusEnum {

    /**
     * 子订单在购物车中的状态
     */
    IN_CART(0, "Order in Cart", "订单在购物车"),
    /**
     * 定制单初始状态，等待确认
     */
    WAITING_CONFIRMED(1, "Your Demands are being confirmed", "需求等待确认"),
    /**
     * 对于渠道商，此时是下单状态
     * 对于销售，此时开始申请报价
     */
    ORDER_PLACEMENT(2, "Order Placement", "下单"),
    /**
     * 渠道商确认订单价格
     */
    CONFIRMATION(3, "Confirmation", "确认"),
    /**
     * 在主订单的合同签署完成，且定金付完后，所有子订单自动进入排查状态
     */
    PRODUCT_PREPARATION(4, "Product Preparation", "排产"),
    /**
     * 生产完成
     */
    PRODUCTION_COMPLETED(5, "Production Completed", "生产完成"),
    /**
     * 拒绝订单
     */
    REJECTED(6, "Rejected", "订单已拒绝");

    private final Integer code;
    private final String descEn;
    private final String descZh;


    public static OrderItemStatusEnum getOrderItemStatusByCode(Integer code) {
        return Arrays.stream(values())
                .filter(status -> status.getCode().equals(code))
                .findFirst().orElse(null);
    }
    
}
